<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title" @click="open">{{ title }}</text>
		</view>
		<view>
			<view>{{ number + 4 }}</view>
			<view>{{ boolean ? 'Yes' : 'No' }}</view>
			<view>{{ message.split('').reverse().join(' ') }}</view>
		</view>
		<view v-if="showExtraInfo" class="extra-info">
			显示的额外信息！
		</view>
		<button @click="toggleExtraInfo">显示/隐藏</button>
		<view v-for="item in arr" class="list-item">
			{{ item.name }}
		</view>
		<view v-for="(item, index) in 4" class="list-item">
			<view :class="'list-' + (index % 2)">{{ index % 2 }}</view>
		</view>
		<view v-for="(value, name, index) in object" class="list-item">
			{{ index }}. {{ name }}: {{ value }}
		</view>
		<view v-for="item in arr" :key="item.id" class="list-item">
			{{ item.id }}: {{ item.name }}
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: "Hello UniApp",
				number: 4,
				boolean: true,
				message: 'Hello Vue',
				showExtraInfo: false,
				arr: [{
						id: 1,
						name: 'uni-app'
					},
					{
						id: 2,
						name: 'HTML'
					}
				],
				object: {
					title: 'How to do lists in Vue',
					author: 'Jane Doe',
					publishedAt: '2020-04-10'
				}
			}
		},
		methods: {
			open() {
				this.title = 'Open new page';
			},
			toggleExtraInfo() {
				this.showExtraInfo = !this.showExtraInfo;
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		align-items: center;
		text-align: center;
		height: 100vh;
		padding: 20px;
		gap: 10px;
		box-sizing: border-box;
	}

	.logo {
		width: 200rpx;
		height: 200rpx;
		margin: 10px;
	}

	.text-area {
		margin: 5px 0;
	}

	.extra-info {
		color: #007AFF;
		font-size: 10px;
	}

	.list-item {
		font-size: 16px;
		line-height: 1.5;
	}

	
</style>